//
//  ByUserMessageVC.m
//  jinpuyiyuan_ios
//
//  Created by mc on 2017/12/4.
//  Copyright © 2017年 mc. All rights reserved.
//

#import "ByUserMessageVC.h"
// other
#import "ZKSegmentControl.h"

// view
#import "ByViewUserMessageNotify.h"

@interface ByUserMessageVC ()
@property (nonatomic, strong) ZKSegmentControl *control;
@end

@implementation ByUserMessageVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"消息";
    [self createViews];
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self setNaviAttributeWithTranslucent:YES stateBarLightContent:YES];
    self.navigationController.navigationBar.hidden = YES;
}

#pragma mark - create views
- (void)createViews{
    UIView *headerView = [[UIView alloc] init];
    [self.view addSubview:headerView];
    [headerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@(0));
        make.left.equalTo(@(0));
        if (SCREEN_HEIGHT == 812) {
            make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, 34));
        }else{
            make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, 20));
        }
    }];
    headerView.backgroundColor = BY_THEME_COLOR;
    
    self.control = [[ZKSegmentControl alloc] init];
    [self.view addSubview:self.control];
    [self.control mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_left);
        make.top.equalTo(headerView.mas_bottom);
        make.right.equalTo(self.view.mas_right);
        if (@available(iOS 11.0,*)) {
       
            make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom).offset(-49);
//            make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop);
        }else{
            make.bottom.mas_equalTo(self.view.mas_bottom).offset(-49);
//            make.top.equalTo(self.view.mas_top);
        }
    }];
    self.control.segmentsArray = @[@"问答",@"通知"];
    self.control.segmentSelectTint = BY_TEXT_COLOR;
    self.control.backgroundColor = BY_TABLE_COLOR;
    self.control.segmentSelectedViewWidthDynamically = @(1);
    self.control.dynamicalAddContentViewBlock = ^(void (^contentViewFetchBlock)(ZKSegmentContentView *contentView), NSInteger selectedIndex) {
//        __weak typeof(self) weakSelf = self;
        if (selectedIndex == 0) {

        }else{
            ByViewUserMessageNotify *notifyView = [[ByViewUserMessageNotify alloc] init];
            if (contentViewFetchBlock) {
                contentViewFetchBlock(notifyView);
            }
        }
    };
//    [self performSelector:@selector(play) withObject:nil afterDelay:20];
}

- (void)play{
//    [self.control setSelectedSegment:1];
}



@end
